package com.timothy.business.util;

import com.timothy.business.constant.ResultStatusEnum;
import com.timothy.business.model.ResultMessage;

public class ResultMessageHelper {

	public static ResultMessage<Object> successResult() {
		ResultMessage<Object> resultMessage = new ResultMessage<>();
		resultMessage.setStatus(ResultStatusEnum.SUCCESS.getStatusValue());
		resultMessage.setMessage("success");
		return resultMessage;
	}

	public static <T> ResultMessage<T> successResult(T result) {
		ResultMessage<T> resultMessage = new ResultMessage<>();
		resultMessage.setStatus(ResultStatusEnum.SUCCESS.getStatusValue());
		resultMessage.setMessage("success");
		resultMessage.setJsonResult(result);
		return resultMessage;
	}

	public static ResultMessage<Object> failResult(ResultStatusEnum statusEnum, String errorMsg) {
		ResultMessage<Object> resultMessage = new ResultMessage<>();
		resultMessage.setStatus(statusEnum.getStatusValue());
		resultMessage.setMessage(errorMsg);
		return resultMessage;
	}
}
